package westh.ilib.service.surveyReport.reportGeneration;

import java.io.BufferedWriter;
import java.io.File;
import java.io.FileWriter;
import java.util.List;

public class ParameterTraining {
	// parameters of sentScorer training
	public static void training(List<SummGenerator.Document> docs) {
		String filepath = "E:\\zhyx\\SurveyReport\\sentence-scorer.arff";
		File file = new File(filepath);
		if (file.exists()) {
			file.delete();
		}

		try {
			BufferedWriter bw = new BufferedWriter(new FileWriter(file));
			bw.write("@relation sentence-scorer");
			bw.newLine();
			bw.write("@attribute simScorer Numeric");
			bw.newLine();
			bw.write("@attribute classScorer Numeric");
			bw.newLine();
			bw.write("@attribute class {0,1}");
			bw.newLine();
			bw.newLine();
			bw.write("@data");
			bw.newLine();

			for (int i = 0; i < docs.size(); i++) {
				System.out.println(docs.get(i).conf + " " + docs.get(i).year + " " + docs.get(i).score + " " + docs.get(i).title);
				for (int j = 0; j < docs.get(i).sents.size(); j++) {
					System.out.println(docs.get(i).sents.get(j).text);
				}
				System.out.println();
				
				for (int j = 0; j < docs.get(i).sents.size(); j++) {
					bw.write(String.valueOf(docs.get(i).sents.get(j).simScore)
							+ ",");
					bw.write(String
							.valueOf(docs.get(i).sents.get(j).classScore)
							+ ",");

					System.out.println(docs.get(i).sents.get(j).text);
					int ch = System.in.read();
					System.in.read();
					System.in.read();

					if (ch == 'y') {
						bw.write("1");
						bw.newLine();
					} else {
						bw.write("0");
						bw.newLine();
					}
				}
			}
			bw.close();
		} catch (Exception e) {
			e.printStackTrace();
		}
	}

	public static void main(String[] args) {

	}
}
